import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import net.mindview.util.TextFile;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;


public class SymDate {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Calendar c = Calendar.getInstance();
		c.set(2000, 0, 1);
		Date time = c.getTime();
		
		
		Calendar c2 = Calendar.getInstance();
		c2.set(3000, 0, 1);
		Date time2 = c2.getTime();
		TextFile tf = new TextFile();		
		Date tmp = time;
		while(time.before(time2)){
			tmp = time;
			String formatDate = new SimpleDateFormat("yyyyMMdd").format(tmp);
			if(isSymDate(formatDate)){
				//System.out.println(formatDate);
				tf.add(formatDate);
			}
			time = DateUtils.addDays(time, 1);
		}
		tf.write("symdates.txt");
	}

	private static boolean isSymDate(String formatDate) {
		String reverse = StringUtils.reverse(formatDate);
		return reverse.equals(formatDate);
	}

}
